

<%@ page import="edu.uow.devdocs.TimeTracker" %>
<%@ page defaultCodec="none" %>
<!DOCTYPE html>
<html>
  <head>
    <meta name="layout" content="main">
    <g:set var="entityName" value="${message(code: 'timeTracker.label', default: 'TimeTracker')}" />
    <title><g:message code="default.list.label" args="[entityName]" /></title>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>

  </head>
  <body>
      <div id="list-timeTracker" class="content scaffold-list" role="main">
        <h1 id="timeTracker"><g:message code="default.list.label" args="[entityName]" /></h1>
        <g:flashMessage/>
    <form action="search">
      <table class="searchable boxSilver">
        <tr>
          <td>Person:</td>
          <td><g:select id="person" name="person" from="${edu.uow.devdocs.Person.list()}" optionKey="id" value="${params?.person}" class="many-to-one" noSelection="['null': '']"/></td>
          <td>System:</td>
          <td><g:select id="system" name="system" from="${edu.uow.devdocs.System.list()}" optionKey="id" value="${params?.system}" class="many-to-one" noSelection="['null': '']"/></td>
          <td>Project:</td>
          <td><g:ajaxSelect id="project" name="project" from="${edu.uow.devdocs.Project.list()}" optionKey="id" value="${params?.project}" class="many-to-one" noSelection="['null': '']" controller="issue" action="ajaxGetIssues" updateId="issue"/></td>
          <td rowspan="3" class="totalHours">Total hours:<br><span class="totalHours">${totalHours }</span></td>
        </tr>
        <tr>
          <td>Project Type:</td>
          <td><g:select id="projectType" name="projectType" from="${edu.uow.devdocs.ProjectType.list()}" optionKey="id" value="${params?.projectType}" class="many-to-one" noSelection="['null': '']"/></td>
          <td>Phase:</td>
          <td><g:select id="phase" name="phase" from="${edu.uow.devdocs.Phase.list()}" optionKey="id" value="${params?.phase}" class="many-to-one" noSelection="['null': '']"/></td>
          <td>Issue:</td>
          <td><g:ajaxSelect id="issue" name="issue" from="${[]}" optionKey="id" value="${params?.issue}" class="many-to-one" noSelection="['null': '']" controller="developmentTask" action="ajaxGetDevelopmentTasks" updateId="developmentTask"/></td>
        </tr>
        <tr>
          <td>Development Task:</td>
          <td><g:ajaxSelect id="developmentTask" name="developmentTask" from="${[]}" optionKey="id" value="${params?.developmentTask}" class="many-to-one" noSelection="['null': '']" controller="developmentChecklist" action="ajaxGetDevelopmentChecklists" updateId="developmentChecklist"/></td>
          <td>Development Checklist:</td>
          <td><g:select id="developmentChecklist" name="developmentChecklist" from="${edu.uow.devdocs.DevelopmentChecklist.list()}" optionKey="id" value="${params?.developmentChecklist}" class="many-to-one" noSelection="['null': '']"/></td>
          <td>Team:</td>
          <td><g:select id="team" name="team" from="${edu.uow.devdocs.Team.list()}" optionKey="id" value="${params?.team}" class="many-to-one" noSelection="['null': '']"/></td>
        </tr>
        <tr>
          <td>Billable?</td>
          <td><g:select id="flagBillable" name="flagBillable" from="${['','Yes','No'] }" value="${params?.flagBillable}"/></td>
          <td>From:</td>
          <td><g:textField class="datepicker" name="dateFrom" value="${params?.dateFrom }"/></td>
          <td>To:</td>
          <td><g:textField class="datepicker" name="dateTo" value="${params?.dateTo }"/></td>
          <td><button type="submit">Search</button></td>
        </tr>
      </table>
    </form>
        <div id="tabs">
          <ul>
            <li><a href="#tab1">Details</a></li>
            <li><a href="#tab2">Project Summary</a></li>
            <li><a href="#tab3">Phase Summary</a></li>
            <li><a href="#tab4">Person Summary</a></li>
          </ul>
        <div id="tab1">
        <table class="sortable">
          <thead>
            <tr>
              <th><g:message code="timeTracker.dateOfWork.label" default="Date Of Work" /></th>
              <th><g:message code="timeTracker.hours.label" default="Hours" /></th>
              <th><g:message code="timeTracker.comments.label" default="Comments" /></th>
              <th><g:message code="timeTracker.taskId.label" default="Task Id" /></th>
              <th><g:message code="timeTracker.project.label" default="Project" /></th>
              <th><g:message code="timeTracker.phase.label" default="Phase" /></th>
              <th><g:message code="timeTracker.person.label" default="Person" /></th>
              <th><g:message code="timeTracker.downtimeReport.label" default="Downtime Report" /></th>
              <th><g:message code="timeTracker.issue.label" default="Issue" /></th>
              <th><g:message code="timeTracker.developmentTask.label" default="Development Task" /></th>
              <th><g:message code="timeTracker.developmentChecklist.label" default="Development Checklist" /></th>
              <th><g:message code="timeTracker.deployment.label" default="Deployment" /></th>
            </tr>
          </thead>
          <tbody>
          <g:each in="${timeTrackerInstanceList}" status="i" var="timeTrackerInstance">
            <tr class="${(i % 2) == 0 ? 'even' : 'odd'}">
              <td><g:link action="show" id="${timeTrackerInstance.id}"><g:formatDate format="dd/MM/yyyy" date="${timeTrackerInstance.dateOfWork}"/></g:link></td>
              <td>${fieldValue(bean: timeTrackerInstance, field: "hours")}</td>
              <td>${fieldValue(bean: timeTrackerInstance, field: "comments")}</td>
              <td>${fieldValue(bean: timeTrackerInstance, field: "taskId")}</td>
              <td>${fieldValue(bean: timeTrackerInstance, field: "project")}</td>
              <td>${fieldValue(bean: timeTrackerInstance, field: "phase")}</td>
              <td>${fieldValue(bean: timeTrackerInstance, field: "person")}</td>
              <td>${fieldValue(bean: timeTrackerInstance, field: "downtimeReport")}</td>
              <td>${fieldValue(bean: timeTrackerInstance, field: "issue")}</td>
              <td>${fieldValue(bean: timeTrackerInstance, field: "developmentTask")}</td>
              <td>${fieldValue(bean: timeTrackerInstance, field: "developmentChecklist")}</td>
              <td>${fieldValue(bean: timeTrackerInstance, field: "deployment")}</td>
            </tr>
          </g:each>
          </tbody>
        </table>
        </div>
        <div id="tab2">
          <gvisualization:pieCoreChart elementId="piechartProject" title="Project Summary" width="850" height="500" data="${grpByProject}" columns="${[['string','Project'],['number','Hours']]}"></gvisualization:pieCoreChart>
          <div id="piechartProject"></div>
          <table class="sortable">
            <thead>
              <tr>
                <th>Project</th>
                <th>Hours</th>
              </tr>
            </thead>
            <tbody>
              <g:each in="${grpByProject }" var="item">
                <tr>
                  <td>${item[0] }</td>
                  <td>${item[1] }</td>
                </tr>
              </g:each>
            </tbody>
          </table>
        </div>
        <div id="tab3">
          <gvisualization:pieCoreChart elementId="piechartPhase" title="Phase Summary" width="850" height="500" data="${grpByPhase}" columns="${[['string','Project'],['number','Hours']]}"></gvisualization:pieCoreChart>
          <div id="piechartPhase"></div>
          <table class="sortable">
            <thead>
              <tr>
                <th>Phase</th>
                <th>Hours</th>
              </tr>
            </thead>
            <tbody>
              <g:each in="${grpByPhase }" var="item">
                <tr>
                  <td>${item[0] }</td>
                  <td>${item[1] }</td>
                </tr>
              </g:each>
            </tbody>
          </table>
        </div>
        <div id="tab4">
          <gvisualization:pieCoreChart elementId="piechartPerson" title="Person Summary" width="850" height="500" data="${grpByPerson}" columns="${[['string','Project'],['number','Hours']]}"></gvisualization:pieCoreChart>
          <div id="piechartPerson"></div>
          <table class="sortable">
            <thead>
              <tr>
                <th>Person</th>
                <th>Hours</th>
              </tr>
            </thead>
            <tbody>
              <g:each in="${grpByPerson }" var="item">
                <tr>
                  <td>${item[0] }</td>
                  <td>${item[1] }</td>
                </tr>
              </g:each>
            </tbody>
          </table>
        </div>
      </div>
    </div>
    <script>
      $(function() {
          $("#tabs").tabs();
      });
    </script>
  </body>
</html>